package com.ctshk.app.user.controller;

import com.ctshk.common.dto.Result;
import com.ctshk.common.web.support.BaseController;
import com.ctshk.rpc.user.req.TransactionIntegralLogReq;
import com.ctshk.rpc.user.req.UserTransactionIntegralCommonReq;
import com.ctshk.rpc.user.service.ITransactionIntegralLogService;
import com.ctshk.rpc.user.service.ITransactionIntegralService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;

/**
 * <p>
 * 积分交易
 * </p>
 *
 * @author 李新科
 * @date 2021/6/30 11:28
 */
@Api(value="积分交易", tags="积分交易")
@RestController
@RequestMapping("/transactionIntegral")
public class TransactionIntegraController extends BaseController {

    @DubboReference
    private ITransactionIntegralService transactionIntegralService;



    @ApiOperation(value="测试新增积分交易", notes="测试积分交易")
    @PostMapping("/testTransaction")
    public Result testTransaction(@RequestBody @Valid UserTransactionIntegralCommonReq req) throws Exception{
        return transactionIntegralService.transactionIntegralCommon(req);
    }

    @ApiOperation(value="测试取消积分交易", notes="测试取消积分交易")
    @PostMapping("/testCancel/{orderId}")
    public Result testCancel(@PathVariable Long orderId) throws Exception{
        return transactionIntegralService.cancelTransactionIntegralCommon(orderId);
    }
}
